package cn.iocoder.yudao.module.system.controller.admin.oauth2;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.carbon.api.emissionfactor.EmissionFactorApi;
import cn.iocoder.yudao.module.carbon.api.emissionfactor.dto.EmissionFactorPageReqDTO;
import cn.iocoder.yudao.module.carbon.api.emissionfactor.dto.EmissionFactorRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 提供给外部应用调用为主
 *
 * @author StevenShen
 */
@Tag(name = "管理后台 - OAuth2.0 碳排放因子")
@RestController
@RequestMapping("/system/oauth2/emission-factor")
@Validated
@Slf4j
public class OAuth2EmissionFactorController {

    @Resource
    private EmissionFactorApi emissionFactorApi;

    @GetMapping("/page")
    @Operation(summary = "获得碳排放因子分页")
    @PreAuthorize("@ss.hasScope('emission-factor.read')")
    CommonResult<PageResult<EmissionFactorRespDTO>> getEmissionFactorPage(@Valid EmissionFactorPageReqDTO reqVO) {
        return emissionFactorApi.getEmissionFactorPage(reqVO);
    }

}